import { defineStore } from 'pinia'

export const useCommonStore = defineStore('common', {
  state: () => ({
    policy: null,
    userInfo: {},
  }),
  actions: {
    saveUserInfo(value) {
      console.log(value)
      this.userInfo = value
    },
    savePolicy(value) {
      this.policy = value
    },
    getUserInfo() {
      return this.userInfo
    },
    getPolicy() {
      return this.policy
    },
    clearPolicy() {
      this.policy = null
    },
    clearUserInfo() {
      this.userInfo = {}
    },
  },
  persist: true,
})
